Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes crash with #emit and unused functions #157

Merged
merged 6 commits into from
Jul 29, 2017

Conversation

VVWVV
Copy link
Contributor

@VVWVV VVWVV commented Mar 13, 2017

Hello!

The crash only happens when the parser skips the initialization of functions with SYSREQ. I.e. if we don't call the functions with #emit SYSREQ, the compiler crashs. BUT it doesn't work with public-functions.

Crash:

// We don't call the somefunc.
stock somefunc()
{
	#emit push.c 100
	#emit push.c 4

	#emit sysreq.c random

	#emit stack 8
	#emit retn
	return 0;
}

main()
{
	
}

Ok:

stock somefunc()
{
	#emit push.c 100
	#emit push.c 4

	#emit sysreq.c random

	#emit stack 8
	#emit retn
	return 0;
}

main()
{
	somefunc(); // We call it.
}

This PR adds a member variable called func_skipped in the symbol struct. This variable keeps track if the function was skipped. Also, in the #emit we check whether we need to mark the native-function as read or not.

VVWVV added 6 commits January 27, 2017 18:30
Signed-off-by: VVWVV <d0u61ev@gmail.com>
Signed-off-by: VVWVV <d0u61ev@gmail.com>
Signed-off-by: VVWVV <d0u61ev@gmail.com>
Signed-off-by: VVWVV <d0u61ev@gmail.com>
@Zeex Zeex merged commit 55f0ac5 into pawn-lang:master Jul 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants